package com.xinqi.modules.mq.course;

import com.xinqi.common.core.enums.RocketMqEnum;
import com.xinqi.common.core.utils.SpringUtils;
import com.xinqi.common.rocketmq.dto.RocketMqBean;
import com.xinqi.modules.mq.course.consumer.CourseConsumer;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author：dzy
 * @Project：xinqi.modules-Cloud-Plus
 * @Date：2023/8/7 13:40
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class CourseRunner implements CommandLineRunner {

    private final RocketMqBean rocketMqBean = SpringUtils.getBean(RocketMqBean.class);

    private final CourseConsumer courseConsumer;

    @Override
    public void run(String... args) throws Exception {
        // 启动课程班级 MQ消息监听
        courseConsumer.courseConsumer(rocketMqBean, RocketMqEnum.COURSE_SYNC);
    }

}
